﻿using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;


namespace FortuneArterial.Site.TFS.Controllers
{
    public class SubmitController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult TeamProjectPicker()
        {
            
            return View();
        }

        public ActionResult ShowProjects(string tfsUrl)
        {
            TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(
                new Uri("http://10.5.10.17:8080/tfs/productdev"),
                new NetworkCredential("liuy03", "lyliuyao", Setting.DOMAIN));
            tfs.EnsureAuthenticated();


            WorkItemStore wis = new WorkItemStore(tfs, WorkItemStoreFlags.BypassRules);

            ICommonStructureService structureService = (ICommonStructureService)tfs.GetService(typeof(ICommonStructureService));
            ProjectInfo[] projects = structureService.ListAllProjects();

            return View(projects);
        }

    }
}
